package com.itsu.graph_v2.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.itsu.graph_v2.entity.User;
import com.itsu.graph_v2.mapper.UserMapper;
import com.itsu.graph_v2.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public List<User> findAll() {
        return userMapper.selectList(Wrappers.query());
    }

    @Override
    public int addUser(User user) {
        return userMapper.insert(user);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateById(user);
    }

    @Override
    public int deleteUser(Integer id) {
        return userMapper.deleteById(id);
    }
}
